package com.xianggu;

import com.xianggu.common.XiangGuService;
import org.springframework.core.io.DefaultResourceLoader;

import java.net.URL;

/**
 * @author chengjy
 * @date 2025/3/9
 */
public class TestClassloader {
    public static void main(String[] args) {
        String path = "com/xianggu/common";
//        URL resource = XiangGuService.class.getClassLoader().getResource(path);
//        System.out.println(resource.getFile());

        DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
        ClassLoader classLoader = resourceLoader.getClassLoader();

        URL resource1 = classLoader.getResource("com/xianggu/common");
        URL resource2 = classLoader.getResource("com/xianggu/demo");
        URL resource3 = classLoader.getResource("com/xianggu");
        System.out.println(resource1.getFile());
    }
}
